import os
import re
def mylistdir(p,f):
    a=os.listdir(p)
    fs=myfind(a,f)
    return(fs)
def myfind(l,p):
    lr=[];
    #print p
    p1=p.replace(".",r"\.")
    p2=p1.replace("*",".*")
    p2=p2+"$"
    for a in l:
        #print a
        if  re.search(p2,a,re.IGNORECASE)==None :
           pass
           #print "pass"
        else:
           lr.append(a)
       #print "append"
    return lr    
def  getfiles():
    return mylistdir(".","*.ui")
def uiCone(f):        
    f=os.path.splitext(f)
    cmd='/usr//bin/uic -g python %s.ui >ui_%s.py' %(f[0],f[0])
    print(cmd)
    os.system(cmd)
fs=getfiles()
for f in fs:
    uiCone(f)
